<template>
	<view class="box" :style="{height:height+'px'}">

		<view class="list" v-if="list.length>0"  @tap="details(item)" v-for="item in list" :key="item.id">
			<view class="list-content">
				<view class="content-top">
					<view class="left">
						{{item.yhmc}}
					</view>
					<view class="right">
						<u-icon name="arrow-right" color="#999999" size="24"></u-icon>
					</view>
				</view>
				<view class="content-foot">
					<view class="foot-box">
						<view class="left">
							<image src="../../static/operation/zhong.png" mode=""></image>
							<text>{{item.zllx == 0 ? '即查即改' : '限期整改'}}</text>
						</view>
						<view class="right">
							<text class="one">生成日期：</text>
							<text class="two" v-if="item.createTime">{{item.createTime.toString().substring(0,4)}}-{{item.createTime.toString().substring(4,6)}}-{{item.createTime.toString().substring(6,8)}} {{item.createTime.toString().substring(8,10)}}:{{item.createTime.toString().substring(10,12)}}</text>
						<text class="two" v-else>--</text>
            </view>
					</view>
				</view>
			</view>
		</view>
	<u-empty
	v-else
	        mode="data"
	        icon="http://cdn.uviewui.com/uview/empty/data.png"
	>
	</u-empty>
	</view>
</template>

<script>
	import {
		troubleshooting,
		detail
	} from '@/api/yhzl.js'

	export default {
		data() {
			return {
				height:null,
				screenHeight:null,
				list: [],
				pageSize: 10,
				pageNum: 1,
				status: 'loadmore',
				obj: {}
			}
		},
		created() {
			this.init()
		},
		onLoad() {
			uni.getSystemInfo({
			    success: res => {
					this.height=res.windowHeight
			     this.screenHeight = (res.windowHeight * (750 / res.windowWidth)) - 336 //将px 转换rpx
			    }
			   });
		},
		methods: {
			onReachBottom() {
				if (this.status == 'loading' || this.status == 'nomore') {
					return;
				}
				this.init()
			},
			onPullDownRefresh() {
				this.pageNum = 1
				this.list = []
				this.init()
			},
			init() {
				let data = {
					state: 2,
					pageSize: this.pageSize,
					pageNum: this.pageNum,
					ysrxm:uni.getStorageSync('userId')
				}
				troubleshooting(data).then((r) => {
					if (r.data.list.length < 10) {
						this.status = "nomore"
					} else {
						this.pageNum++
						this.status = 'loadmore'
					}
					this.list = this.list.concat(r.data.list)
					uni.stopPullDownRefresh();
				})
			},
			details(item) {
					uni.navigateTo({
						url: `/pages/hiddenTroubleXqTwo/hiddenTroubleXqTwo?details=${JSON.stringify(item)}`,
					});

			}
		}
	}
</script>

<style lang="scss">
	.box {
		width: 100vw;
		// height: calc(100vh - 88rpx);
		background-color: #F6F6F6;
		padding: 40rpx 24rpx;
		box-sizing: border-box;

	.list {
			width: 702rpx;
			height: 200rpx;
			background-color: #fff;
			border-radius: 16rpx;
			padding: 32rpx 48rpx;
			box-sizing: border-box;
			margin-bottom: 20rpx;

			.list-content {
				width: 100%;
				height: 100%;

				// background-color: skyblue;
				.content-top {
					width: 100%;
					height: 60rpx;
					border-bottom: 1rpx #EEEEEE solid;
					display: flex;
					justify-content: space-between;

					.left {
						font-size: 32rpx;
						color: #333333;
					}
				}

				.content-foot {
					width: 100%;
					height: 75rpx;

					// background-color: aqua;
					.foot-box {
						margin-top: 15rpx;
						width: 100%;
						height: 60rpx;
						background-color: #F6F6F6;
						padding: 0 16rpx;
						box-sizing: border-box;
						display: flex;
						justify-content: space-between;
						align-items: center;

						.left {
							image {
								width: 28rpx;
								height: 28rpx;
								vertical-align: middle;
							}

							text {
								margin-left: 8rpx;
								font-size: 24rpx;
								color: #999999;
								vertical-align: middle;
							}
						}

						.right {
							flex: 1;
							margin-left: 100rpx;
							text {

								font-size: 24rpx;
								color: #999999;
							}

							.one {

								width: 100rpx;
							}
						}
					}
				}
			}
		}
	}
</style>
